package com.example.concurrency.queue;

import com.example.concurrency.queue.thread.Consumer;
import com.example.concurrency.queue.thread.Producer;

import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.LinkedBlockingDeque;
import java.util.concurrent.LinkedBlockingQueue;

/**
 * <p>
 *
 * </p>
 *
 * @author Ashe
 * @version V1.2.0
 * @date 2019年08月20日 19:49
 * @modificationHistory=========================逻辑或功能性重大变更记录
 * @modify By: {修改人} 2019年08月20日
 * @modify reason: {方法名}:{原因}
 * ...
 */
public class LinkedBlockingQueueEx {

    /**
     * 链阻塞队列
     * @param args
     * @throws InterruptedException
     */
    public static void main(String[] args) throws InterruptedException {
        BlockingQueue queue = new LinkedBlockingQueue();
        Producer producer = new Producer(queue);
        Consumer consumer = new Consumer(queue);
        new Thread(producer).start();
        new Thread(consumer).start();
        Thread.sleep(4000);
    }
}

